<%var jstpl = {%>
<script>
var  app =  new Vue({
	el:"#gexin_body",
	data:{
		query:{app_title:"",pageNumber:1,pageSize:10},
		data_result:{}
	},created:function(){
		this.loadPage("init")
	},methods:{
		loadPage:function(model){  //载入模式有两种  init初始化载入 load分页载入
			if(model=="init"){
				this.query.pageNumber=1;
			}
			Ajax("/system/weixin/appconfig/query",this.query,function(d){
				app.data_result=d;
			    if(d.firstPage==true){
				  layui.laypage.render({
					elem: 'gexin_page' //注意，这里的 test1 是 ID，不用加 # 号
					,layout:['count', 'prev', 'page', 'next', 'limit', 'skip']
					,count: d.totalRow //数据总数，从服务端得到
					,limit:app.query.pageSize
					,jump: function(obj, first){
						app.query.pageNumber=obj.curr;
						if(app.query.pageSize!=obj.limit){
						 app.query.pageSize=obj.limit;
						 app.loadPage("init");
						 return ;
						}
					    if(!first){
						   app.loadPage("load");
						}
					 }
				  });
				}
			})
		},edit:function(id){
			window.location.href="/system/weixin/appconfig/add_edit/"+id;
		},del:function(id){
			gx.confirm("你是否确定删除这条信息？",function(){
				gx.ajax('/system/weixin/appconfig/delete/'+id,function(d){
					if(d.state==true){
						layer.closeAll();
						app.loadPage("load");
					}else{
						gx.alert(d.msg);
					}
				})
			})
		}
	}
})
</script>
<%};%>
<%var csstpl = {%>
   <style type="text/css">
   [v-cloak]{display:none}
   </style>
<%};%>
<%layout("../layout/_layout_layui.html",{title:'微信配置信息列表',jstpl:jstpl,csstpl:csstpl}){ %>
<div class="layui-row"  v-cloak>
<div class="layui-col-md12">
  <div class="layui-col-md4">
         <div class="layui-form-item ">
         <label class="layui-form-label" >应用名称</label>
	    <div class="layui-input-block">
	      <input type="text" name="app_title" v-model="query.app_title"  placeholder="请输入应用名称" autocomplete="off" class="layui-input">
	    </div>	
     </div>
  </div>
    
  
  <div class="layui-col-md4">
   <div class="layui-form-item">
  <div class="layui-inline">
    <div class="layui-input-block" >
       <button type="button" @click="loadPage('init')" class="layui-btn layui-btn-normal">查询</button>
						<a href="/system/weixin/appconfig/add_edit" type="submit" class="layui-btn layui-btn-normal">
							<i class="layui-icon">&#xe608;</i> 添加配置
						</a>
					</div>
  </div>
   </div>
  </div>
  
</div>

<div class="layui-col-md12" style="margin-top: 10px">
 <table class="layui-table">
        <thead>
            <tr>
                <th>ID</th>
                <th>应用名称</th>
                <th>应用ID</th>
                <th>应用秘钥</th>
                <th>token值</th>
                <th>消息加密</th>
                <th>最后更新时间</th>
                <th></th>
          	</tr>
        </thead>
      <tbody id="tbody_body">
        <tr v-for="d  in  data_result.list">
        <td>{{d.id}}</td>
        <td>{{d.app_title}}</td>
        <td>{{d.app_id}}</td>
        <td>{{d.app_secret}}</td>
        <td>{{d.token}}</td>
        <td>
		<span v-if="d.message_encrypt==0" class="layui-badge layui-bg-orange">false</span>
		<span v-if="d.message_encrypt==1" class="layui-badge layui-bg-green">true</span>
		</td>
        <td>{{d.createtime}}</td>
        <td>
          <span class="action-col layui-btn-group">
            <button class="layui-btn layui-btn-primary layui-btn-sm" @click="edit(d.id)"><i class="layui-icon">&#xe642;</i> 编辑</button>
		    <button v-if="d.id!=1"  class="layui-btn layui-btn-primary layui-btn-sm" @click="del(d.id)"><i class="layui-icon">&#xe640;</i> 删除</button>
		  </span>
		</td>
        
        </tr>
		<tr v-if="data_result.list==0">
		 <td  colspan="8" style="text-align:center;height:300px"><h1>没有数据</h1></td>
		</tr>
      </tbody >
    </table>
<fieldset id="gexin_page" class="layui-elem-field layui-field-title" >
</fieldset>
</div>
</div>
<%};%>